/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


// the first state depends on style of the object, to hide display:none expected
//

function toggleDisplay(id)
{
    elmt=document.getElementById(id);

    if(arguments[1]!=null) param=arguments[1];
    else param='block';

    if(elmt!==null)
    {
        if(elmt.style.display=='none') elmt.style.display=param;
        else elmt.style.display='none';
    }
}

function enableChecked(id)
{
    document.getElementById(id).checked=true;
}

function toggleChecked(id)
{
    element = document.getElementById(id);

    if(element.checked)
    {
        element.checked=false;
    }
    else
    {
        element.checked=true;
    }
}

/* XdumperTable check all */
function xdtCheckAll(leadingCheckbox)
{
    idsCount = document.getElementById("idsCount").value;

    for(idNum = 0; idNum < idsCount; idNum++)
    {
        checkbox = document.getElementById("id"+idNum);

        if(leadingCheckbox.checked)
        {
            checkbox.checked = true;
        }
        else
        {
            checkbox.checked = false;
        }
    }
}

function xdrtSwapColors(checkBoxId)
{
    checkBox = document.getElementById(checkBoxId);
    newCell = document.getElementById(checkBoxId+"n");
    oldCell = document.getElementById(checkBoxId+"o");

    if(checkBox.checked)
    {
        newCell.style.color = "green";
        oldCell.style.color = "red";
    }
    else
    {
        newCell.style.color = "red";
        oldCell.style.color = "green";
    }
}

function openTab(hashParam, tabId)
{
    if(location.hash.indexOf(hashParam)>-1)
    {
        document.getElementById(tabId).style.display='block';
    }
}